package cn.itsource.exam.service.impl;

import cn.itsource.exam.domain.StudentExam;
import cn.itsource.exam.mapper.ExamResultMapper;
import cn.itsource.exam.query.ExamResultQuery;
import cn.itsource.exam.service.ExamResultService;
import cn.itsource.exam.util.PageList;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ExamResultServiceImpl implements ExamResultService {
    @Autowired
    ExamResultMapper examResultMapper;
    @Override
    public PageList selectExamResultList(ExamResultQuery query) {
        int i = examResultMapper.countExamResultList(query);
        if (i==0){
            return new PageList();
        }
        return new PageList(i,examResultMapper.selectExamResultList(query));
    }

    @Override
    public void updateExam(StudentExam exam) {
        examResultMapper.updateById(exam);
    }

    @Override
    public void confirmExam(Long id) {
        examResultMapper.updateExamState(id);
    }
}
